import axios from 'axios'
import Vue from 'vue'
import VueRouter from 'vue-router'
import Config from '../../config/app.config'
import Cookies from 'js-cookie';
Vue.use(VueRouter)

const fetch = axios.create({
    baseURL: Config.http_url,
    withCredentials: true
})

// 添加请求拦截器
fetch.interceptors.request.use((config) => {

    return config
}, (error) => {
    // 对请求错误做些什么
    return Promise.reject(error)
})

// 添加响应拦截器
fetch.interceptors.response.use((res) => {
    return res
}, (error) => {
    // 对响应错误做点什么
    return Promise.reject(error)
})

export default fetch
